< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03030105.xhp

(section: weekday) (bookmark: bm_id3153127)
WeekDay function

WeekDay 関数

WeekDay Function [Runtime]
WeekDay 関数 [実行時](hd_id3153127.1)

Returns the number corresponding to the weekday represented by a serial date number that is generated by the DateSerial or the DateValue function.
DateSerial ないし DateValue 関数による日付データのシリアル変換値を基に、該当する曜日を示す数値を返します。(par_id3146795.2)

(/section: weekday)

Syntax:
構文:(hd_id3145068.3)

WeekDay (Number)
WeekDay (Number)(par_id3149655.4)

Return value:
戻り値:(hd_id3148799.5)

Integer
整数(par_id3154125.6)

Parameters:
パラメータ:(hd_id3150768.7)

Number: Integer expression that contains the serial date number that is used to calculate the day of the week (1-7).
Number: 曜日情報 (1-7) を得る日付データのシリアル変換値を示す数値表式。(par_id3151042.8)

The following example determines the day of the week using the WeekDay function when you enter a date.
下記の例では、プログラム実行日の曜日を WeekDay 関数を用いて表示させています。(par_id3159254.9)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3148616.10)

Sub ExampleWeekDay
Sub ExampleWeekDay(par_id3145749.11)

Dim sDay As String
Dim sDay As String(par_id3147426.12)

REM Return and display the day of the week
REM 本日の曜日の取得と表示(par_id3148576.13)

Select Case WeekDay( Now )
Select Case WeekDay( Now )(par_id3155412.14)

case 1
case 1(par_id3155306.15)

sDay="Sunday"
sDay="Sunday"(par_id3151117.16)

case 2
case 2(par_id3152460.17)

sDay="Monday"
sDay="Monday"(par_id3153952.18)

case 3
case 3(par_id3149666.19)

sDay="Tuesday"
sDay="Tuesday"(par_id3153157.20)

case 4
case 4(par_id3154730.21)

sDay="Wednesday"
sDay="Wednesday"(par_id3154942.22)

case 5
case 5(par_id3145799.23)

sDay="Thursday"
sDay="Thursday"(par_id3155416.24)

case 6
case 6(par_id3150716.25)

sDay="Friday"
sDay="Friday"(par_id3154015.26)

case 7
case 7(par_id3146971.27)

sDay="Saturday"
sDay="Saturday"(par_id3153707.28)

End Select
End Select(par_id3155065.29)

msgbox "" + sDay,64,"Today is"
msgbox "" + sDay,64,"Today is"(par_id3148993.30)

End Sub
End Sub(par_id3149019.31)


< Prev / Next >